﻿using System;
using System.Windows;
using System.Reflection;

namespace Rabbit.Themes
{
    public static class ThemeManager
    {
        public static ResourceDictionary GetTheme(string themeName)
        {
            if (themeName != null)
            {
                Assembly assembly = Assembly.LoadFrom("Rabbit.Themes.dll");
                string packageUri = string.Format(@"/Rabbit.Themes;component/{0}/theme.xaml", themeName);

                return Application.LoadComponent(new Uri(packageUri, UriKind.Relative)) as ResourceDictionary;
            }
            return null;
        }

        public static void ApplyTheme(this Application app, string theme)
        {
            app.Resources.MergedDictionaries.Clear();
        }

        public static System.Collections.Generic.List<Theme> GetThemeList()
        {
            System.Collections.Generic.List<Theme> list = new System.Collections.Generic.List<Theme>();
            list.Add(new Theme() { Name = "默认皮肤", Value = "Win7" });
            list.Add(new Theme() { Name = "蓝色经典", Value = "Fresh" });
            return list;
        }
    }

    public class Theme{
        public string Name { get; set; }
        public string Value { get; set; }
    }
}
